package com.weaver.drools.business.sys.permission.service.impl;

import java.util.List;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.weaver.drools.business.sys.permission.service.ISysPermissionService;
import com.weaver.drools.common.dao.SysPermissionDao;
import com.weaver.drools.common.entity.SysPermission;
/**
 * 
 *  @application name: 
 *  @author: zhouxinlei 
 *  @time：2018年6月27日
 *  @version：ver 1.1
 */
@Service
public class PermissionServiceImpl implements ISysPermissionService {
	@Resource
	private SysPermissionDao permissionDao;
	
	public void deletePermission(Long Id) {
		permissionDao.deleteById(Id);
	}
	public void savePermission(SysPermission permission) {
		permissionDao.save(permission);
	}
	public void updatePermission(SysPermission permission) {
		permissionDao.save(permission);
	}
	public SysPermission findPermissionInfo(Long Id) {
		SysPermission permission = permissionDao.findPermissionById(Id);
		return permission;
	}
	public List<SysPermission> findPermissiontList() {
		String hql =" from SysPermission where 1=1 and permission.id =0 and id !=0 order by id asc";
		List<SysPermission> treeList = permissionDao.findListByhql(hql);
		return treeList;
	}
	
	public List<SysPermission> findPermissiontListNode() {
		String hql =" from SysPermission where 1=1 and permission.id !=0 and id !=0 order by id asc";
		List<SysPermission> treeList = permissionDao.findListByhql(hql);
		return treeList;
	}
	public List<SysPermission> findPermissiontMenuList() {
		String hql =" from SysPermission where deleteFlag=0 and permission.id =0 and id !=0 order by id asc";
		List<SysPermission> treeList = permissionDao.findListByhql(hql);
		return treeList;
	}
}
